package com.principle.proxy.dynamic;

public class Client {
    public static void main(String[] args) {
        TeacherDao teacherDao = new TeacherDao();
        //给目标对象，创建代理对象，可以转成 IteacherDao
        ProxyFactory proxyFactory = new ProxyFactory(teacherDao);
        ITeacherDao proxyInstance = (ITeacherDao) proxyFactory.getProxyInstance();
        System.out.println("proxyFactory="+proxyFactory.getClass());
        //proxyInstance=class com.sun.proxy.$Proxy0 内存中动态生成了代理对象
        System.out.println("proxyInstance="+proxyInstance.getClass());
        proxyInstance.teach();
    }
}
